<?PHp
/* ...
 * Add more '_model' before class
 */
?>
<div class="modal fade" id="model_form_qoute" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">Email Quote</h4>
            </div>
            <div class="modal-body">
                <div id="info_sucess_quote" style="display: none;color: green;">  You requested quote successfully<br/></div>
                <div class="alert alert-success">
                    <p>
                        <label>Name</label>
                        <input type="text" id="name_model" name="name_model" value="" />
                        <span id="error-name_model" class="error" ></span>
                    </p>
                    <p>
                        <label>Email</label>
                        <input type="text" id="txt-email_model" name="txt-email_model" value="" />
                        <span id="error-email_model" class="error" ></span>
                    </p>
                    <p>
                        <label> Phone number</label>
                        <input type="text" id="txt-phone_model" name="txt-phone_model" value="" />
                        <span id="error-phone_model" class="error" ></span>
                    </p>
                    <div class="class_br"></div>
                    <div>
                        <input type="radio" name="typeFlights_model" id="typeFlights1_model" value="<?php echo DealFlight::ONEWAY; ?>" />
                        <label class="label-flights_model">One Way</label>
                        <input type="radio" checked="check" name="typeFlights_model" id="typeFlights2_model" value="<?php echo DealFlight::ROUNDTRIP; ?>" />
                        <label class="label-flights_model" >Round Trip</label>
                        <input type="radio" name="typeFlights_model" id="typeFlights3_model" value="<?php echo DealFlight::MULTICITY; ?>" />
                        <label  class="label-flights2_model" >Multi City</label> 
                        <span id="error-type-flight_model" class="error" ></span>
                    </div>

                    <div class="class_br clear"></div>
                    <div  id="content_leving_model"> 
                        <p><label>Leaving from</label>
                            <input  placeholder="Enter City/State" type="text" id="leaving-from_model" name="leaving-from_model" class="txt-state-search"/>
                            <span id="error-leaving-form_model" class="error" ></span>
                        </p>
                        <div class="class_br"></div>
                        <p><label> Going to  </label>
                            <input type="text" placeholder="Enter City/State"  id="going-to_model" name="going-to_model" class="txt-state-search"/>
                            <span id="error-going-to_model" class="error" ></span>
                        </p>

                        <div class="class_br"></div>
                        <p>
                            <label class="label_all"><span id="depart1" style="color: #3c763d !important;"> 
                                    Departure date</span><span style="color: #3c763d !important;" id="return1_model" > - Return date</span>
                            </label> 
                            <br class="clear" />
                        <table>
                            <tr class="time_der">
                                <td>
                                    <input  type="text"  id="departure-date_model" name="departure-date_model" />
                                    <img id="image_button_model" width="20px;" src="<?php echo get_template_directory_uri(); ?>/images/icon_datetime.png"/>

                                </td>
                                <td> - </td>
                                <td>
                                    <span id="span-return-date_model" ><input type="text" id="return-date_model" name="return-date_model" />
                                        <img id="image_button2_model"   width="20px;" src="<?php echo get_template_directory_uri(); ?>/images/icon_datetime.png"/>
                                    </span>
                                </td>
                            </tr>
                        </table>


                        <span id="error-start-time_model" class="error" ></span>
                        <span id="error-end-time_model" class="error" ></span>
                        </p>



                    </div>
                    <div  id="content_leving2_model" style="display: none;">
                        <div class="div-boder">
                            <p><label>Leaving from</label>
                                <input  placeholder="Enter City/State" type="text" id="leaving-from1_model" name="leaving-from1_model" class="txt-state-search"/>
                                <span id="error-leaving-form1_model" class="error" ></span>
                            </p>
                            <div class="class_br"></div>
                            <p><label> Going to  </label>
                                <input type="text" placeholder="Enter City/State"  id="going-to1_model" name="going-to1_model" class="txt-state-search"/>
                                <span id="error-going-to1_model" class="error" ></span>
                            </p>
                            <div class="class_br"></div>
                            <p>
                            <p>
                                <label class="label_all"><span id="depart1_model" > 
                                        Departure date</span><span id="return1" > - Return date</span></label> <br/>
                            </p>
                            <table>
                                <tr class="time_der">
                                    <td >
                                        <input type="text"  id="departure-date1_model" name="departure-date1_model" />
                                        <img id="image_buttona1_model" width="20px;" src="<?php echo get_template_directory_uri(); ?>/images/icon_datetime.png"/>
                                        <span id="span-return-date" >

                                    </td>
                                    <td> - </td>
                                    <td>
                                        <input type="text" id="return-date1_model" name="return-date1_model" />
                                        <img id="image_buttonb1_model"   width="20px;" src="<?php echo get_template_directory_uri(); ?>/images/icon_datetime.png"/>
                                        </span>
                                    </td>
                                </tr>
                                <tr>
                                    <td>

                                        <span id="error-start-time1_model" class="error" ></span>
                                        <span id="error-end-time1_model" class="error" ></span>
                                    </td>
                                </tr>
                            </table>


                            </p>
                            <hr/>
                            <p><label>Leaving from</label>
                                <input  placeholder="Enter City/State" type="text" id="leaving-from2_model" name="leaving-from2_model" class="txt-state-search"/>
                                <span id="error-leaving-form2_model" class="error" ></span>
                            </p>
                            <div class="class_br"></div>
                            <p><label> Going to  </label>
                                <input type="text" placeholder="Enter City/State"  id="going-to2_model" name="going-to2_model" class="txt-state-search"/>
                                <span id="error-going-to2_model" class="error" ></span>
                            </p>
                            <div class="class_br"></div>
                            <p >
                                <label class="label_all"><span id="depart2_model" > 
                                        Departure date</span><span id="return1" > - Return date</span></label> <br/>
                            </p>

                            <p>
                            <table>
                                <tr class="time_der">
                                    <td >
                                        <input type="text" id="departure-date2_model" name="departure-date2_model" />
                                        <img id="image_buttona2_model" width="20px;" src="<?php echo get_template_directory_uri(); ?>/images/icon_datetime.png"/>
                                    </td>
                                    <td>
                                        -
                                    </td>
                                    <td>
                                        <span id="span-return-date_model" >
                                            <input type="text"id="return-date2_model" name="return-date2_model" />
                                            <img id="image_buttonb2_model"   width="20px;" src="<?php echo get_template_directory_uri(); ?>/images/icon_datetime.png"/>
                                        </span>
                                    </td>
                                </tr>
                                <tr>

                                    <td><span id="error-start-time2_model" class="error" ></span>
                                        <span id="error-end-time2_model" class="error" ></span></td>
                                </tr>
                            </table>
                            </p>

                            <div class="id_tab3_model"  >
                                <hr/>
                                <p><label>Leaving from</label>
                                    <input  placeholder="Enter City/State" type="text" id="leaving-from3_model" name="leaving-from3_model" class="txt-state-search"/>
                                    <span id="error-leaving-form3_model" class="error" ></span>
                                </p>
                                <div class="class_br"></div>
                                <p><label> Going to  </label>
                                    <input type="text" placeholder="Enter City/State"  id="going-to3_model" name="going-to3_model" class="txt-state-search"/>
                                    <span id="error-going-to3_model" class="error" ></span>
                                </p>
                                <div class="class_br"></div>
                                <p>
                                    <label class="label_all"><span id="depart3" > 
                                            Departure date</span><span id="return3" > - Return date</span></label> <br/>
                                </p>

                                <p>
                                <table>
                                    <tr class="time_der">
                                        <td >
                                            <input type="text" id="departure-date3_model" name="departure-date3_model" />
                                            <img id="image_buttona2_model" width="20px;" src="<?php echo get_template_directory_uri(); ?>/images/icon_datetime.png"/>
                                        </td>
                                        <td>
                                            -
                                        </td>
                                        <td>
                                            <span id="span-return-date" style="color: #ffffff !important;">
                                                <input type="text" style="width: 96px;" id="return-date3_model" name="return-date3_model" />
                                                <img id="image_buttonb3_model"   width="20px;" src="<?php echo get_template_directory_uri(); ?>/images/icon_datetime.png"/>
                                            </span> 
                                        </td>
                                    </tr>
                                    <tr><td>
                                            <span id="error-start-time3_model" class="error" ></span>
                                            <span id="error-end-time3_model" class="error" ></span>
                                        </td>
                                    </tr>
                                </table>


                                </p>

                            </div>
                            <div class="id_tab4_model">
                                <hr/>
                                <p><label>Leaving from</label>
                                    <input  placeholder="Enter City/State" type="text" id="leaving-from4_model" name="leaving-from4_model" class="txt-state-search"/>
                                    <span id="error-leaving-form4_model" class="error" ></span>
                                </p>
                                <div class="class_br"></div>
                                <p><label> Going to  </label>
                                    <input type="text" placeholder="Enter City/State"  id="going-to4_model" name="going-to4_model" class="txt-state-search"/>
                                    <span id="error-going-to4_model" class="error" ></span>
                                </p>
                                <div class="class_br"></div>
                                <p>
                                    <label class="label_all">
                                        <span id="depart4"> 
                                            Departure date</span><span  > - Return date</span></label> <br/>
                                </p>
                                <p>
                                <table>
                                    <tr class="time_der">
                                        <td >
                                            <input type="text"  id="departure-date4_model" name="departure-date4_model" />
                                            <img id="image_buttona4_model" width="20px;" src="<?php echo get_template_directory_uri(); ?>/images/icon_datetime.png"/>
                                        </td>
                                        <td>
                                            -
                                        </td>
                                        <td>
                                            <span id="span-return-date" >
                                                <input type="text" style="width: 96px;" id="return-date4_model" name="return-date4_model" />
                                                <img id="image_buttonb4_model"   width="20px;" src="<?php echo get_template_directory_uri(); ?>/images/icon_datetime.png"/>
                                            </span>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <span id="error-start-time4_model" class="error" ></span>
                                            <span id="error-end-time4_model" class="error" ></span>
                                        </td>
                                    </tr>
                                </table>

                                </p>

                            </div>

                            <input type="button" value="+ Add more flights"  class="bttngrey" id="addMoreBtnMulti_int_model" tabindex="20">
                            <input type="hidden" value="2" name="morest_model" id="morest_model"  />

                        </div>

                    </div>
                    <div>

                    </div>

                    <div class="class_br"></div>
                    <p> 
                        <label class="div_type_human">Adult(12+)  </label> 
                        <select  id="Adult_model" name="Adult_model" class="select-find-flights" >
                            <?php
                            for ($i = 1; $i <= 9; $i++) {
                                echo '<option value="' . $i . '" >' . $i . '</option>';
                            }
                            ?>
                        </select>

                    </p>
                    <p>
                        <label class="div_type_human">Children(2-12)</label> 
                        <select  id="numCHD_model" name="numCHD_model" class="select-find-flights" >
                            <?php
                            for ($i = 0; $i < 9; $i++) {
                                echo '<option value="' . $i . '" >' . $i . '</option>';
                            }
                            ?>
                        </select>
                    </p>
                    <p>
                        <label class="div_type_human" > Infant(0-2)</label>
                        <select id="infant_model" name="infant_model"  class="select-find-flights">

                            <option>0</option>
                            <option>1</option>
                        </select>
                    </p>
                    <div class="class_br"></div>
                    <p>
                        <label  class="div_type_human"> Class </label>
                        <select name="class_model" id="class_model" class="select-find-flights"   class="div_class">
                            <option value="<?php echo DealFlight::ECONOMY; ?>">Economy</option>
                            <option value="<?php echo DealFlight::BUSINESS; ?>">Business</option>
                            <option value="<?PHP echo DealFlight::FIRST_CLASS ?>">First Class</option>
                            <option value="<?php echo DealFlight::PREMIUM_ECONOMY ?>">Premium Economy</option>
                        </select>

                    </p>
                    <div class="class_br"></div>
                    <p>
                        <label  class="div_type_human"> Country </label>
                        <select name="city_model" id="city_model"  class="select-find-flights country-select">
                            <?php $countries = Country::listCountry(); ?>
                            <?php
                            foreach ($countries as $key => $value) {
                                echo '<option value="' . $key . '">' . $value . '</option>';
                            }
                            ?>
                        </select>
                    </p>
                    <p >
                        <input type="button" class="button"  name="tb-search-flights_model" id="tb-search-flights_model"  value="Submit" />

                    </p>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript" lang="javascript">

jQuery(document).ready(function(){
    
    jQuery('#image_button_model').click(function() {
        jQuery('#departure-date_model').datetimepicker('show'); //support hide,show and destroy command
    });

    jQuery('#image_button2_model').click(function() {
        jQuery('#return-date_model').datetimepicker('show'); //support hide,show and destroy command
    });


    
        jQuery('#departure-date_model').datetimepicker({
            format: 'd/m/Y',
            onShow: function(ct) {
                this.setOptions({
                    maxDate: jQuery('#return-date_model').val() ? jQuery('#return-date_model').val() : false
                })
            },
            timepicker: false
        });
        jQuery('#return-date_model').datetimepicker({
            format: 'd/m/Y',
            onShow: function(ct) {
                this.setOptions({
                    minDate: jQuery('#departure-date_model').val() ? jQuery('#departure-date_model').val() : false
                })
            },
            timepicker: false
        });
    


    jQuery('#image_buttona1_model').click(function() {
        jQuery('#departure-date1_model').datetimepicker('show'); //support hide,show and destroy command
    });

    jQuery('#image_buttonb1_model').click(function() {
        jQuery('#return-date1_model').datetimepicker('show'); //support hide,show and destroy command
    });


    
        jQuery('#departure-date1_model').datetimepicker({
            format: 'd/m/Y',
            onShow: function(ct) {
                this.setOptions({
                    maxDate: jQuery('#return-date1_model').val() ? jQuery('#return-date1_model').val() : false
                })
            },
            timepicker: false
        });
        jQuery('#return-date1_model').datetimepicker({
            format: 'd/m/Y',
            onShow: function(ct) {
                this.setOptions({
                    minDate: jQuery('#departure-date1_model').val() ? jQuery('#departure-date1_model').val() : false
                })
            },
            timepicker: false
        });



    jQuery('#image_buttona2_model').click(function() {
        jQuery('#departure-date2_model').datetimepicker('show'); //support hide,show and destroy command
    });

    jQuery('#image_buttonb2_model').click(function() {
        jQuery('#return-date2_model').datetimepicker('show'); //support hide,show and destroy command
    });


    
    
        jQuery('#departure-date2_model').datetimepicker({
            format: 'd/m/Y',
            onShow: function(ct) {
                this.setOptions({
                    maxDate: jQuery('#return-date2_model').val() ? jQuery('#return-date2_model').val() : false
                })
            },
            timepicker: false
        });
        jQuery('#return-date2_model').datetimepicker({
            format: 'd/m/Y',
            onShow: function(ct) {
                this.setOptions({
                    minDate: jQuery('#departure-date2_model').val() ? jQuery('#departure-date2_model').val() : false
                })
            },
            timepicker: false
        });

    jQuery('#image_buttona3_model').click(function() {
        jQuery('#departure-date3_model').datetimepicker('show'); //support hide,show and destroy command
    });

    jQuery('#image_buttonb3_model').click(function() {
        jQuery('#return-date3_model').datetimepicker('show'); //support hide,show and destroy command
    });

        jQuery('#departure-date3_model').datetimepicker({
            format: 'd/m/Y',
            onShow: function(ct) {
                this.setOptions({
                    maxDate: jQuery('#return-date3_model').val() ? jQuery('#return-date3_model').val() : false
                })
            },
            timepicker: false
        });
        jQuery('#return-date3_model').datetimepicker({
            format: 'd/m/Y',
            onShow: function(ct) {
                this.setOptions({
                    minDate: jQuery('#departure-date3_model').val() ? jQuery('#departure-date3_model').val() : false
                })
            },
            timepicker: false
        });


    jQuery('#image_buttona4_model').click(function() {
        jQuery('#departure-date4_model').datetimepicker('show'); //support hide,show and destroy command
    });

    jQuery('#image_buttonb4_model').click(function() {
        jQuery('#return-date4_model').datetimepicker('show'); //support hide,show and destroy command
    });


    jQuery(function() {
        jQuery('#departure-date4_model').datetimepicker({
            format: 'd/m/Y',
            onShow: function(ct) {
                this.setOptions({
                    maxDate: jQuery('#return-date4_model').val() ? jQuery('#return-date4_model').val() : false
                })
            },
            timepicker: false
        });
        jQuery('#return-date4_model').datetimepicker({
            format: 'd/m/Y',
            onShow: function(ct) {
                this.setOptions({
                    minDate: jQuery('#departure-date4_model').val() ? jQuery('#departure-date4_model').val() : false
                })
            },
            timepicker: false
        });
    });


    /*
     * Add databaese
     */
    jQuery('#typeFlights1_model').click(function() {

        // alert('AAAAAAAA');
        // var html2 = getinfoRoundTrip();
        // jQuery("#content_leving").html(html2);
        jQuery('#content_leving2_model').hide();
        jQuery('#content_leving_model').show();
        jQuery('#return1_model').css({opacity: 0.3});
        jQuery('#span-return-date_model').css({opacity: 0.3});
        jQuery("#addMoreBtnMulti_int_model").show();

        jQuery('.id_tab3_model').hide();
        jQuery('.id_tab4_model').hide();

    });

    jQuery('#typeFlights2_model').click(function() {

        //var html2 = getinfoRoundTrip();
        // jQuery("#content_leving").html(html2);
        jQuery('#content_leving2_model').hide();
        jQuery('#content_leving_model').show();
        jQuery('#return1_model').css({opacity: 1});
        jQuery('#span-return-date_model').css({opacity: 1});


        jQuery("#addMoreBtnMulti_int_model").show();
        jQuery('.id_tab3_model').hide();
        jQuery('.id_tab4_model').hide();

    });

    jQuery('#return-date_model').click(function() {
        //  alert('AAAAAA');

        // var html2 = getinfoRoundTrip();
        //jQuery("#content_leving").html(html2);
        jQuery('#content_leving2_model').hide();
        jQuery('#content_leving_model').show();
        jQuery('#return1_model').css({opacity: 1});
        jQuery('#span-return-date_model').css({opacity: 1});
        document.getElementById('typeFlights2_model').checked = 'check';

        jQuery("#addMoreBtnMulti_int_model").show();

        jQuery('.id_tab3_model').hide();
        jQuery('.id_tab4_model').hide();

    });


    jQuery('#return1_model').click(function() {

        //var html2 = getinfoRoundTrip();
        // jQuery("#content_leving").html(html2);
        jQuery('#content_leving2_model').hide();
        jQuery('#content_leving_model').show();
        jQuery('#return1_model').css({opacity: 1});
        jQuery('#span-return-date_model').css({opacity: 1});
        document.getElementById('typeFlights2_model').checked = 'check';

        jQuery("#addMoreBtnMulti_int_model").show();

        jQuery('.id_tab3_model').hide();
        jQuery('.id_tab4_model').hide();

    });
    jQuery('#typeFlights3_model').click(function() {

        jQuery('#content_leving2_model').show();
        jQuery('#content_leving_model').hide();

    });



    jQuery('#addMoreBtnMulti_int_model').click(function() {


        var idStt = jQuery("#morest_model").val();

        idStt = parseInt(idStt) + 1;


        if (idStt < 5) {
            jQuery('.id_tab' + idStt + '_model').show();
            jQuery("#morest_model").val(idStt);

        }
        else
        {
            jQuery("#addMoreBtnMulti_int_model").hide();
        }

    });




    jQuery("#tb-search-flights_model").click(function() {


        var dataTrue = 1;
        var typeFlights = 0;
        var siteUrl = jQuery('#site_url').val();

        var dsstartLocation = new Array();

        var dsendLocation = new Array();

        var dsstartDate = new Array();

        var dsEndDate = new Array();

        var url_ajax = siteUrl + "/wp-content/themes/travel_donald/ajax/request_a_quote.php";

        //var typeFlights1 = jQuery('#typeFlights1').checked ; 
        /// alert(typeFlights1);

        var name = jQuery("#name_model").val();


        if (name == "") {
            jQuery("#error-name_model").html('Please you check Name');
            dataTrue = 0;
        }
        else
        {
            jQuery("#error-name_model").html('');
        }

        var email = jQuery("#txt-email_model").val();
        if (email == "")
        {
            jQuery("#error-email_model").html('Please you check Email');
            dataTrue = 0;

        }
        else
        {
            var re = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-]{1,})+\.)+([a-zA-Z0-9]{2,})+$/;
            if (!re.test(email)) {

                jQuery("#error-email_model").html('The email is not correct');
                dataTrue = 0;
            }
            else {

                jQuery("#error-email_model").html('');


            }

        }

        phone = jQuery("#txt-phone_model").val();

        if (phone == "") {

            jQuery("#error-phone_model").html('Please you check Phone');
            dataTrue = 0;
        }
        else {
            jQuery("#error-phone_model").html('');
        }




        if (jQuery('#typeFlights1_model').is(":checked"))
        {
            typeFlights = 1;

        }
        if (jQuery('#typeFlights2_model').is(":checked"))
        {
            typeFlights = 2;

        }
        if (jQuery('#typeFlights3_model').is(":checked"))
        {
            typeFlights = 3;

        }
        if (typeFlights == '0') {

            jQuery("#error-type-flight_model").html('Please you check type flights');
            dataTrue = 0;
        }
        else {
            jQuery("#error-type-flight_model").html('');
        }



        if (typeFlights == 2)
        {
            var startLocation = jQuery('#leaving-from_model').val();
            if (startLocation == "") {
                jQuery("#error-leaving-form_model").html('Leaving from must not be  blank');
                dataTrue = 0;

            } else {
                jQuery("#error-leaving-form_model").html('');
            }

            var endLocation = jQuery('#going-to_model').val();

            if (endLocation == "")
            {
                jQuery('#error-going-to_model').html('Going to must not be blank');
                dataTrue = 0;
            }
            else
            {
                jQuery("#error-going-to_model").html('');

            }
            var startDate = jQuery('#departure-date_model').val();
            if (startDate == "") {
                jQuery("#error-start-time_model").html('Departure date must not be blank<br/>');
                dataTrue = 0;
            }
            else {
                jQuery("#error-start-time_model").html("");
            }

            var endDate = jQuery("#return-date_model").val();
            if (endDate == "") {

                jQuery("#error-end-time_model").html('Return date must not be blank');
                dataTrue = 0;
            }
            else {
                jQuery('#error-end-time_model').html("");

            }

            for (var i = 1; i <= 4; i++) {
                jQuery("#error-leaving-form" + i + '_model').html('');
                jQuery("#error-going-to" + i + '_model').html('');
                jQuery("#error-start-time" + i + '_model').html("");
                jQuery('#error-end-time' + i + '_model').html("");
            }
        }
        else if (typeFlights == 1) {
            var startLocation = jQuery('#leaving-from_model').val();
            if (startLocation == "") {
                jQuery("#error-leaving-form_model").html('Leaving from must not be  blank');
                dataTrue = 0;

            } else {
                jQuery("#error-leaving-form_model").html('');
            }

            var endLocation = jQuery('#going-to_model').val();
            if (endLocation == "")
            {
                jQuery('#error-going-to_model').html('Going to must not be blank');
                dataTrue = 0;
            }
            else
            {
                jQuery("#error-going-to_model").html('');

            }
            var startDate = jQuery('#departure-date_model').val();
            if (startDate == "") {
                jQuery("#error-start-time_model").html('Departure date must not be blank<br/>');
                dataTrue = 0;
            }
            else {
                jQuery("#error-start-time_model").html("");
            }


            for (var i = 1; i <= 4; i++) {
                jQuery("#error-leaving-form" + i + '_model').html('');
                jQuery("#error-going-to" + i + '_model').html('');
                jQuery("#error-start-time" + i + '_model').html("");
                jQuery('#error-end-time' + i + '_model').html("");
            }
        }
        else
        {

            var idStt = jQuery("#morest_model").val();
            for (var i = 1; i <= idStt; i++) {


                var startLocation = jQuery('#leaving-from' + i + '_model').val();

                dsstartLocation.push(startLocation);

                if (startLocation == "") {
                    jQuery("#error-leaving-form" + i + '_model').html('Leaving from must not be  blank');
                    dataTrue = 0;

                }
                else {
                    jQuery("#error-leaving-form" + i + '_model').html('');
                }


                var endLocation = jQuery('#going-to' + i + '_model').val();
                dsendLocation.push(endLocation);

                if (endLocation == "")
                {
                    jQuery('#error-going-to' + i + '_model').html('Going to must not be blank');
                    dataTrue = 0;
                }
                else
                {
                    jQuery("#error-going-to" + i + '_model').html('');

                }

                var startDate = jQuery('#departure-date' + i + '_model').val();

                dsstartDate.push(startDate);

                if (startDate == "") {
                    jQuery("#error-start-time" + i + '_model').html('Departure date must not be blank<br/>');
                    dataTrue = 0;
                }
                else {
                    jQuery("#error-start-time" + i + '_model').html("");
                }

                var endDate = jQuery("#return-date" + i + '_model').val();

                dsEndDate.push(endDate);

                if (endDate == "") {

                    jQuery("#error-end-time" + i + '_model').html('Return date must not be blank');
                    dataTrue = 0;
                }
                else {
                    jQuery('#error-end-time' + i + '_model').html("");

                }

                jQuery("#error-leaving-form_model").html('');
                jQuery("#error-going-to_model").html('');
                jQuery("#error-start-time_model").html("");
                jQuery('#error-end-time_model').html("");
            }
        }

        // alert(dsstartLocation);
        // return;

        var adult = jQuery("#Adult_model").val();
        var children = jQuery('#numCHD_model').val();
        var infant = jQuery("#infant_model").val();
        var classa = jQuery("#class_model").val();
        var city = jQuery("#city_model").val();
        //alert(startLocation);
        if (dataTrue == 1) {

            if (typeFlights == 1)
            {

                $.post(url_ajax, {typeFlights: typeFlights, name: name, email: email, phone: phone, startLocation: startLocation, endLocation: endLocation, startDate: startDate, adult: adult, children: children, infant: infant, class: classa, city: city}, function(data) {

                    // alert(data);
                    // jQuery("#success-request_quote").modal();
                    jQuery("#name_model").val("");
                    jQuery("#txt-email_model").val("");
                    jQuery("#txt-phone_model").val("");
                    jQuery("#leaving-from_model").val("");
                    jQuery("#going-to_model").val("");
                    jQuery("#departure-date_model").val("");
                    jQuery("#return-date_model").val("");

                    jQuery("#leaving-from1_model").val("");
                    jQuery("#going-to1_model").val("");
                    jQuery("#departure-date1_model").val("");
                    jQuery("#return-date1_model").val("");

                    jQuery("#leaving-from2_model").val("");
                    jQuery("#going-to2_model").val("");
                    jQuery("#departure-date2_model").val("");
                    jQuery("#return-date2_model").val("");

                    jQuery("#leaving-from3_model").val("");
                    jQuery("#going-to3_model").val("");
                    jQuery("#departure-date3_model").val("");
                    jQuery("#return-date3_model").val("");


                    jQuery("#leaving-from4_model").val("");
                    jQuery("#going-to4_model").val("");
                    jQuery("#departure-date4_model").val("");
                    jQuery("#return-date4_model").val("");
                    
                     jQuery("#model_form_qoute").modal('hide');
                    jQuery("#info_sucess_quote").show();

                });
            }
            else if (typeFlights == 2)
            {
                //alert(2);
                $.post(url_ajax, {typeFlights: typeFlights, name: name, email: email, phone: phone, startLocation: startLocation, endLocation: endLocation, startDate: startDate, endDate: endDate, adult: adult, children: children, infant: infant, class: classa, city: city}, function(data) {

                    // alert(data);
                    jQuery("#name_model").val("");
                    jQuery("#txt-email_model").val("");
                    jQuery("#txt-phone_model").val("");
                    jQuery("#leaving-from_model").val("");
                    jQuery("#going-to_model").val("");
                    jQuery("#departure-date_model").val("");
                    jQuery("#return-date_model").val("");

                    jQuery("#leaving-from1_model").val("");
                    jQuery("#going-to1_model").val("");
                    jQuery("#departure-date1_model").val("");
                    jQuery("#return-date1_model").val("");

                    jQuery("#leaving-from2_model").val("");
                    jQuery("#going-to2_model").val("");
                    jQuery("#departure-date2_model").val("");
                    jQuery("#return-date2_model").val("");

                    jQuery("#leaving-from3_model").val("");
                    jQuery("#going-to3_model").val("");
                    jQuery("#departure-date3_model").val("");
                    jQuery("#return-date3_model").val("");


                    jQuery("#leaving-from4_model").val("");
                    jQuery("#going-to4_model").val("");
                    jQuery("#departure-date4_model").val("");
                    jQuery("#return-date4_model").val("");
                     jQuery("#model_form_qoute").modal('hide');
                    jQuery('#success-request_quote').modal();

                });
            }
            else
            {

                $.post(url_ajax, {typeFlights: typeFlights, name: name, email: email, phone: phone, startLocation: dsstartLocation, endLocation: dsendLocation, startDate: dsstartDate, endDate: dsEndDate, adult: adult, children: children, infant: infant, class: classa, city: city}, function(data) {

                    //  jQuery("#success-request_quote").modal();
                    jQuery("#name_model").val("");
                    jQuery("#txt-email_model").val("");
                    jQuery("#txt-phone_model").val("");
                    jQuery("#leaving-from_model").val("");
                    jQuery("#going-to_model").val("");
                    jQuery("#departure-date_model").val("");
                    jQuery("#return-date_model").val("");

                    jQuery("#leaving-from1_model").val("");
                    jQuery("#going-to1_model").val("");
                    jQuery("#departure-date1_model").val("");
                    jQuery("#return-date1_model").val("");

                    jQuery("#leaving-from2_model").val("");
                    jQuery("#going-to2_model").val("");
                    jQuery("#departure-date2_model").val("");
                    jQuery("#return-date2_model").val("");

                    jQuery("#leaving-from3_model").val("");
                    jQuery("#going-to3_model").val("");
                    jQuery("#departure-date3_model").val("");
                    jQuery("#return-date3_model").val("");


                    jQuery("#leaving-from4_model").val("");
                    jQuery("#going-to4_model").val("");
                    jQuery("#departure-date4_model").val("");
                    jQuery("#return-date4_model").val("");
                    jQuery("#model_form_qoute").modal('hide');
                    jQuery('#success-request_quote').modal();
                    //  alert(data);

                });
            }


        }



    });

});

</script>



